Register User
Endpoint
To register a new user, make a POST
request to the following endpoint:
https://api.betatel.com/api/auth/register
Request Body
The request should contain the following fields:
{
"firstName": "Test",
"lastName": "User",
"email": "povid681@nokdot.com",
"password": "Password12345!"
}
Param | Value | Type | Required | Description |
---|---|---|---|---|
firstName | Test | String | Yes | The user's first name |
lastName | User | String | Yes | The user's last name |
povid681@nokdot.com | String | Yes | The user's email address | |
password | Password12345! | String | Yes | The user's password |
Let’s Get Coding!
Now, choose your preferred programming language and get started with the examples below.
- cUrl
- Python
- Node.js
- PHP
- Java
- C#
Example - cURL
curl --location 'https://api.betatel.com/api/auth/register' \
--header 'Content-Type: application/json' \
--data-raw '{
"firstName": "Test",
"lastName": "User",
"email": "povid681@nokdot.com",
"password": "Password12345!"
}'
Example - Python
import http.client
import json
conn = http.client.HTTPSConnection("api.betatel.com")
payload = json.dumps({
"firstName": "Test",
"lastName": "User",
"email": "povid681@nokdot.com",
"password": "Password12345!"
})
headers = {
'Content-Type': 'application/json',
}
conn.request("POST", "/api/auth/register", payload, headers)
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
Example - Node.js
const axios = require('axios');
let data = JSON.stringify({
"firstName": "Test",
"lastName": "User",
"email": "povid681@nokdot.com",
"password": "Password12345!"
});
let config = {
method: 'post',
maxBodyLength: Infinity,
url: 'https://api.betatel.com/api/auth/register',
headers: {
'Content-Type': 'application/json',
},
data : data
};
axios.request(config)
.then((response) => {
console.log(JSON.stringify(response.data));
})
.catch((error) => {
console.log(error);
});
Example - PHP
<?php
$curl = curl_init();
curl_setopt_array($curl, array(
CURLOPT_URL => 'https://api.betatel.com/api/auth/register',
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => '',
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 0,
CURLOPT_FOLLOWLOCATION => true,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => 'POST',
CURLOPT_POSTFIELDS =>'{
"firstName": "Test",
"lastName": "User",
"email": "povid681@nokdot.com",
"password": "Password12345!"
}',
CURLOPT_HTTPHEADER => array(
'Content-Type: application/json',
),
));
$response = curl_exec($curl);
curl_close($curl);
echo $response;
Example - Java
Unirest.setTimeouts(0, 0);
HttpResponse<String> response = Unirest.post("https://api.betatel.com/api/auth/register")
.header("Content-Type", "application/json")
.body("{\n \"firstName\": \"Test\",\n \"lastName\": \"User\",\n \"email\": \"povid681@nokdot.com\",\n \"password\": \"Password12345!\"\n}")
.asString();
Example - C#
var client = new HttpClient();
var request = new HttpRequestMessage(HttpMethod.Post, "https://api.betatel.com/api/auth/register");
var content = new StringContent("{\n \"firstName\": \"Test\",\n \"lastName\": \"User\",\n \"email\": \"povid681@nokdot.com\",\n \"password\": \"Password12345!\"\n}", null, "application/json");
request.Content = content;
var response = await client.SendAsync(request);
response.EnsureSuccessStatusCode();
Console.WriteLine(await response.Content.ReadAsStringAsync());
Response
JSON Schema:
{
"id": "67ea622b0552935fac5cd1ad",
"firstName": "Test",
"lastName": "User",
"email": "povid681@nokdot.com",
"role": "user",
"status": "active",
"isVerified": false,
"createdAt": "2025-03-31T09:36:43.610Z",
"updatedAt": "2025-03-31T09:36:43.610Z"
}
🎉 Congratulations – Mission Accomplished!
🔜 What’s Next? Now that you have successfully registered a new user, you can proceed with integrating other endpoints, such as login, profile management, or password recovery, into your application!